package kafka;

import kafka.listener.MyApplicationStartedEventListener;
import kafka.service.KafkaConsumer;
import org.apache.log4j.PropertyConfigurator;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.context.embedded.ConfigurableEmbeddedServletContainer;
import org.springframework.boot.context.embedded.EmbeddedServletContainerCustomizer;
import org.springframework.boot.context.web.SpringBootServletInitializer;
import org.springframework.web.context.WebApplicationContext;

import javax.servlet.MultipartConfigElement;


//@Import({DynamicDataSourceRegister.class}) // 注册动态多数据源
@SpringBootApplication
public class Application  extends SpringBootServletInitializer{


//	@Override
//	protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
//
//		return application.sources(Application.class);
//
//	}


	@Override
	public WebApplicationContext run(SpringApplication sa) {

		super.run(sa);
		new KafkaConsumer().consume();

		return null;

	}


//	public static void main(String[] args) {
////		SpringApplication springApplication = new SpringApplication(Application.class);
////		springApplication.addListeners(new MyApplicationStartedEventListener());
//		SpringApplication.run(Application.class, args);
//
//	}

//	@Override
//	public void customize(ConfigurableEmbeddedServletContainer container) {
//		container.setPort(8088);
//	}
}
